import Vue from 'vue'
import VueRouter from 'vue-router'
// 练习一
import HomePage from '../views/HomePage'
import Classification from '../views/Classification'
import Order from '../views/Order'
import My from '../views/My'
import NotFound from '../views/NotFound'
// 练习二
import Main from '../views/02Main'
import News from '../views/02News'
import Play from '../views/02Play'
// 2.1
import PlayMain from '../views/02-1PlayMain'
import DomesticSports from '../views/02-1DomesticSports'
import ForeignSports from '../views/02-1ForeignSports'
// 作业
import UIRouter from '../views/03UIRouter'
import Contacts from '../views/03Contacts'
import About from '../views/03About'
//3.1
import Allcontacts from '../views/03-1Allcontacts'
import Alice from '../views/03-1Alice'
import Bob from '../views/03-1Bob'
//3.2
import Blog from '../views/03-2Blog'
import Fax from '../views/03-2Fax'

Vue.use(VueRouter)

const routes = [
  //练习一
  {
    path: '/',
    // redirect:'/homePage'  练习一
    // redirect:'/main'  练习二
    redirect:'/uIRouter'
  },
  {
   path:'/homePage',
   name:'HomePage',
   component: HomePage
  },
  {
    path:'/classification',
    name:'Classification',
    component: Classification
   },
   {
    path:'/order',
    name:'Order',
    component: Order
   },
   {
    path:'/my',
    name:'My',
    component: My
   },
   {
    path:'*',
    component: NotFound
   },
   //练习二
   {
    path:'/main',
    name:'Main',
    component: Main
   },
   {
    path:'/news',
    name:'News',
    component: News
   },
   {
    path:'/play',
    name:'Play',
    component: Play,
    redirect:'/play/playMain',
    children:[
      {
        path:'playMain',
        name:'PlayMain',
        component: PlayMain
       },
       {
        path:'domesticSports',
        name:'DomesticSports',
        component: DomesticSports
       },
       {
        path:'foreignSports',
        name:'ForeignSports',
        component: ForeignSports
       },
    ]
   },
   //作业
   {
    path:'/uIRouter',
    name:'UIRouter',
    component: UIRouter
   },
   {
    path:'/contacts',
    name:'Contacts',
    component: Contacts,
    children:[
      {
        path:'allcontacts',
        name:'Allcontacts',
        component: Allcontacts
       },
       {
        path:'alice',
        name:'Alice',
        component: Alice
       },
       {
        path:'bob',
        name:'Bob',
        component: Bob,
        children:[
          {
            path:'blog',
            name:'Blog',
            component: Blog,
          },
          {
            path:'fax',
            name:'Fax',
            component: Fax,
          }
        ]
       },
    ]
   },
   {
    path:'/about',
    name:'About',
    component: About
   },
   
]

const router = new VueRouter({
  routes
})

export default router
